import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkProductModelVO, ParkProductModelForm, ParkProductModelQuery } from '@/api/park/parkProductModel/types';

/**
 * 查询产品模型列表
 * @param query
 * @returns {*}
 */

export const listParkProductModel = (query?: ParkProductModelQuery): AxiosPromise<ParkProductModelVO[]> => {
  return request({
    url: '/park/parkProductModel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品模型详细
 * @param modelId
 */
export const getParkProductModel = (modelId: string | number): AxiosPromise<ParkProductModelVO> => {
  return request({
    url: '/park/parkProductModel/' + modelId,
    method: 'get'
  });
};

/**
 * 新增产品模型
 * @param data
 */
export const addParkProductModel = (data: ParkProductModelForm) => {
  return request({
    url: '/park/parkProductModel',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品模型
 * @param data
 */
export const updateParkProductModel = (data: ParkProductModelForm) => {
  return request({
    url: '/park/parkProductModel',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品模型
 * @param modelId
 */
export const delParkProductModel = (modelId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkProductModel/' + modelId,
    method: 'delete'
  });
};
